﻿@using System.Web.Optimization
@using Ed.Common
@using Ed.Entity
@using Ed.Web.Helpers
@model Ed.Entity.TClientInfo
@{
    //客户信息
    var customer = (TClientInfo)ViewBag.Customer;
    //月嫂信息
    //var yuesaoes = (List<TPregnanterInfo>)ViewBag.Yuesao;
    //订单信息
    var order = (TOrder)ViewBag.Order;
     //下单人
    string orderCreaterName = "";
    if (ViewBag.OrderCreaterName != null)
    {
        orderCreaterName = ViewBag.OrderCreaterName;
    }
    var pricetype = ViewBag.PriceType;
    //订单编号（自动生成）
    var orderCode = RandomHelper.GetOrderNumber();
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>雪绒花云服务_订单第三步输入客户信息</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="X-UA-Compatible" conte="conte" nt="IE=Edge" />
    @Styles.Render("~/Themes/default/css/cp.globle.min1.css")
    @Scripts.Render("~/Themes/default/js/cp.globle.min1.js")
    <style type="text/css">
        .jineng
        {
            font-size: 12px;
            padding: 2px 3px;
            color: #FFFFFF;
            background-color: #328eb4;
            margin-right: 5px;
        }
    </style>
    <script src="~/Themes/default/base/js/city.js"></script>
    <!--my97DatePicker-->
    <script src="/Themes/default/lib/my97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <style type="text/css">
        .commontable
        {
            margin-top: 20px;
        }
        .commontable td
        {
            padding: 3px 5px;
            text-align: left;
            color: #726F6F;
            line-height: 22px;
        }
        .commontable td.tit
        {
            background-color: #EBECEE;
            text-align: center;
            width: 110px;
            color: #000;
        }
        .commontable th
        {
            width: 70px;
            text-align: right;
            font-weight: normal;
        }
        .commontable .yuesao_list .list
        {
            display: block;
            line-height: 30px;
            height: 30px;
            width: 100%;
            border: 1px solid #ccc;
            margin-top: -1px;
            overflow: hidden;
        }
        .commontable .yuesao_list .list span
        {
            display: block;
            float: left;
            width: 15%;
            text-align: center;
            color: green;
        }
        .commontable .yuesao_list .list a
        {
            margin-left: 20px;
        }
        .commontable .yuesao_list .list span.green
        {
            color: green;
        }
        .teshu
        {
            margin-top: 10px;
        }
    </style>
    <script type="text/javascript">
        //=============================================================
        //去除顶层加载中
        $(document).ready(function () {
            //去除加载中
            if (undefined != top.dialog.list["show_loading"]) {
                top.dialog.list["show_loading"].close().remove();
                //showTopMsg("页面加载成功！", "温馨提示", "Success");
            }
        });
        //=====================================================================
    </script>
    <script type="text/javascript">
        $(function () {

            validate_form();

            //            //选择医院时触发写入值
            //            $("#HospitalSelect").change(function () {
            //                var xx = $("#HospitalSelect option:selected").text();
            //                var yy = $("#HospitalSelect option:selected").val();
            //                $("#YorderHospital").val(xx);
            //                $("#YorderHaddress").val(yy);
            //            });
            //加载省市数据
            load_city_data("ClientProv", "ClientArea", "ClientRegion");
            init_city_data("ClientProv", "ClientArea", "ClientRegion", "@customer.ClientCity");
            //
//            var now = '@DateTime.Now.ToString("yyyy-MM-dd")';
//            $("#ClientBirthday").val(now);
//            $("#ClientAge").val(0);
        });
        //表单验证
        function validate_form() {
            $("#step4_form").validate({
                errorPlacement: function (error, element) {
                    var errorMsg = error[0].innerHTML;
                    var elementName = element[0].name;
                    $("#" + elementName).formtip(errorMsg);
                    //showMsg(errorMsg, "错误提示", "Error");
                    $("#" + elementName).attr("placeholder", errorMsg);
                },
                success: function (element) {
                    var elem = $(element)[0].htmlFor;
                    $("#" + elem).poshytip('disable');
                    $("#" + elem).poshytip('destroy');
                    $("#" + elem).removeClass("error").addClass("success");
                    //身份证号码生成生日
                    if (elem == "ClientIdcard") {
                        idcard_to_birth_age($.trim($("#" + elem).val()));
                    }
                }
            });
        }
        //身份证生成生日和年龄
        function idcard_to_birth_age(cardNum) {
            if (isChinaIDCard(cardNum)) {
                var bir = get_birthday_by_idcard(cardNum);
                var now = '@DateTime.Now.ToString("yyyy-MM-dd")';
                var age = YearDiff(bir, now);
                $("#ClientBirthday").val(bir);
                $("#ClientAge").val(age);
            }
        }
    </script>
  @*  <script type="text/javascript">

        function submit_order() {
            if (!$("#step4_form").valid()) {
                return false;
            }
            //var data = $(client_form).serializeObject();
            var data = $("#step4_form").serialize();
           // console.log(data);
            //return;
            $.ajax({
                type: "POST",
                cache: false,
                url: "/api/CorderApi/EditHuisuoInfo",
                data: data,
                dataType: "json",
                beforeSend: function () {
                    //显示加载中
                    showTopDialog("show_loading", "<div class='dialog_loading'>月子会所订单确认中，请稍后...</div>", "温馨提示", 400, 95);
                },
                complete: function () {
                },
                success: function (result) {
                    top.dialog.list["show_loading"].close().remove();
                    //toLowerCase报错
                    //var status = result.Status.toLowerCase();
                    var status = result.Status;
                    if (status == true || status == "true" || status == "True") {
                        //刷新数据
                        show_order_success();

                    } else {
                        showMsg("系统异常，订单添加失败！", "Error");
                    }
                },
                error: function () {
                    top.dialog.list["show_loading"].close().remove();
                    showMsg("网络连接错误!", "错误提示", "Error");
                }
            });


            //必须有这个，阻止刷新
            return false;

        }
        //预定成功
        function show_order_success() {
            var d = top.dialog({
                id: "show_order_success",
                title: "预定完成",
                content: "<div class='dialog_ok'>恭喜你，成功添加月嫂订单！</div>   ",
                width: 400,
                height: 80,
                okValue: '关闭',
                ok: function () {
                    //关闭添加框
                    top.dialog.list["show_add_huisuo"].close().remove();
                    //关闭提示框
                    top.dialog.list["show_order_success"].close().remove();
                    //跳转到客户管理
                    //                    showTopContentWindow("show_order_success", "/Customer/ClientInfo/List", "客户信息管理", 1000, 500);
                },
                cancelValue: '继续添加订单',
                cancel: function () {
                    //关闭添加框
                    top.dialog.list["show_add_huisuo"].close().remove();
                    //关闭提示框
                    top.dialog.list["show_order_success"].close().remove();
                    //跳转到订单添加
                    showTopContentWindow("show_add_client", "/Order/YingshiOrder/AddClient/", "1. 确认客户信息", 500, 200);
                }
            });
            d.showModal();
        }
    </script>*@
     <script type="text/javascript">

         //表单验证方法，供父窗口调用
         function form_valid() {
             if ($("#step4_form").valid()) {
                 var all = $("#OrderSumMoney").val();
                 var prepay = $("#OrderPrepaid").html();

                 var nopay = $("#OrderSumMoney").html();
                 nopay = (all - prepay);
                 if (prepay < 0) {
                     showTopMsg("总金额小于预付款", "错误提示！", "Error");
                     return false;
                 }
//                 var xx = $(':radio[name="YorderYuesao"]:checked').val();
//                 if (xx == undefined) {
//                     showTopMsg("必须选择一个育婴师！", "错误提示！", "Error");
//                     return false;
////                 }
                 return true;
             } else {
                 return false;
             }
         } 
    </script>
    <script type="text/javascript">
        //      @*  $(function () {
        //            var city = get_city_names("@customer.ClientCity");
        //            var addr = city + " " + $("#ClientCity").html();
        //            $("#ClientCity").html(addr);
        //        });*@
        function pregnanterinfo_view(id) {
            var url = "/Yuesao/PregnanterInfo/View?id=" + id;
            //console.log(id);
            showTopContentWindow("pregnanterinfo_show_view", url, "查看月嫂", 810, 500);

            //必须有这个，阻止刷新
            return false;
        }
    </script>
</head>
<body>
    <div class="boxwarp">
        <form id="step4_form">
        <table width="900" border="0" cellspacing="0" cellpadding="0" class="commontable">
            <tbody>
                <tr>
                    <td colspan="9">
                        <div style="height: 3px;">
                        </div>
                    </td>
                </tr>
                <tr>
                    <td rowspan="2" class="tit">
                        <label>
                            月子会所</label><br />
                    </td>
                </tr>
                <tr>
                    <th>
                        <span class="must">*</span>订单内容：
                    </th>
                    <td colspan="8">
                        <textarea class="form-control required"   cols="4" id="OrderNote" maxlength="200" minlength="1"
                            name="OrderNote" rows="2" style="width: 100%;">@order.OrderNote</textarea>
                    </td>
                    </td>
                    <input type="hidden" id="YorderPtype" name="YorderPtype" value="@pricetype" />
                </tr>
                <tr>
                    <td colspan="9">
                        <div style="height: 3px;">
                        </div>
                    </td>
                </tr>
                <tr>
                    <td rowspan="6" class="tit">
                        <label>
                            订单信息</label><br />
                    </td>
                    <!---隐藏值-->
                    <input type="hidden" id="OrderCode" name="OrderCode" value="@orderCode" />
                    <th>
                        <span class="must">*</span>开始时间：
                    </th>
                    <td style="color: blue; font-size: 14px;">
                        <input value="@Html.DateTimeNullPalse(@order.OrderBegin).ToString("yyyy-MM-dd")" class="form-control Wdate dateISO required" data-val="true" data-val-date="填入正确格式"
                            id="orderStart" maxlength="10" minlength="10" name="orderStart" onclick="WdatePicker()"
                            type="text">
                    </td>
                    <th>
                        <span class="must">*</span>结束时间：
                    </th>
                    <td style="color: blue; font-size: 14px;">
                        <input value="@Html.DateTimeNullPalse(@order.OrderEnd).ToString("yyyy-MM-dd")" class="form-control Wdate dateISO required" data-val="true" data-val-date="填入正确格式"
                            id="OrderEnd" maxlength="10" minlength="10" name="OrderEnd" onclick="WdatePicker()"
                            type="text">
                    </td>
                </tr>
                <tr>
                </tr>
                <tr>
                    <tr>
                        @*<th>预产医院：</th><td><input class="form-control" id="YorderHospital" name="YorderHospital" placeholder="预产医院" style="width:220px;" type="text" value="" /></td>*@
                        @*<th>详细地址：</th><td colspan="6"><input class="form-control" id="YorderHaddress" name="YorderHaddress" placeholder="医院详细地址" style="width:100%;" type="text" value="" /></td>*@
                    </tr>
                    <th>@*订单内容：*@
                    </th>
                    <td colspan="8">
                        @*<textarea class="form-control" cols="4" id="OrderNote" maxlength="200" minlength="1" name="OrderNote" rows="2" style="width:100%;"></textarea>*@
                    </td>
                </tr>
                <tr>
                    <th>
                        下单相关：
                    </th>
                    <td>
                        @orderCreaterName ( @Html.DateTimeNullPalse(order.OrderDate).ToString("yyyy-MM-dd"))
                    </td>
                     <th>
                        处理相关：
                    </th>
                    <td colspan="8">
                        <input type="text" id="OrderWeihuName" name="OrderWeihuName" class="form-control isreadonly" value="@Session[EdKeys.SESSION_USER_NAME]" onfocus = "this.blur()" />
                        <input type="hidden" id="OrderWeihu" name="OrderWeihu" value="@Session[EdKeys.SESSION_USER_ID]"/>
                        @Html.TextBox("OrderProcesstime", order.OrderProcesstime, new { @class = "form-control isreadonly", Value = @Html.LoadDefaultValue(@Html.DateTimeNullPalse(order.OrderProcesstime).ToString("yyyy-MM-dd"), DateTime.Now.ToString("yyyy-MM-dd")), @onfocus = "this.blur()" })
                    </td>
                    <td colspan="5">
                    </td>
                </tr>
                <tr>
                    <td colspan="9">
                        <div style="height: 3px;">
                        </div>
                    </td>
                </tr>
                <tr>
                    <td class="tit" rowspan="5">
                        <label>
                            客户信息</label>
                    </td>
                    <!--客户id-->
                    @Html.HiddenFor(model => model.Id)
                    @*<th>
                        <span class="must">*</span>客户编号：
                    </th>*@
                    @Html.HiddenFor(model => model.ClientCode, new { @class = "form-control isreadonly", @style = "width: 200px; color:red;font-weight:bold;", @placeholder = "系统自动生成", @onfocus = "this.blur();" })
                    <th>
                        <span class="must">*</span>客户姓名：
                    </th>
                    <td colspan="2">
                        <input class="form-control required" id="ClientName" name="ClientName" placeholder="姓名"
                            style="width: 200px;" type="text" value="@customer.ClientName" minlength="1" maxlength="16" />
                    </td>
                </tr>
                <tr>
                    <th>
                        <span class="must">*</span>联系手机：
                    </th>
                    <td>
                        <input class="form-control required" id="ClientTel" name="ClientTel" placeholder="手机号码"
                            minlength="11" maxlength="11" style="width: 200px;" type="text" value="@customer.ClientTel1" />
                    </td>
                    <th>
                        所属民族：
                    </th>
                    <td>
                        <input class="form-control required CHS" id="ClientNational" name="ClientNational"
                            placeholder="汉族" style="width: 115px;" type="text" value="@customer.ClientNational" />                      
                    </td>
                </tr>
                <tr>
                    <th>
                        身份证号：
                    </th>
                    <td>
                        <input class="form-control idcard" id="ClientIdcard" name="ClientIdcard" placeholder="可自动生成生日及年龄"
                            type="text" style="width: 200px;" value="@customer.ClientIdcard" />
                    </td>
                    <th>
                        客户生日：
                    </th>
                    <td>
                        <input class="form-control isreadonly" id="ClientBirthday" name="ClientBirthday"
                            placeholder="客户生日" style="width: 140px;" type="text" value=" @Html.DateTimeNullPalse(@customer.ClientBirthday).ToString("yyyy-MM-dd")" onfocus="this.blur();" />
                        <input class="form-control isreadonly" id="ClientAge" name="ClientAge" placeholder="年龄"
                            style="width: 45px;" type="text" value="@customer.ClientAge" onfocus="this.blur();" />岁
                    </td>
                </tr>
                <tr>
                    <th>
                        家庭住址：
                    </th>
                    <td colspan="8">
                        <select id="ClientProv" name="ClientProv" style="width: 100px;" class="form-control">
                            <option value="0" selected="selected">请选择</option>
                        </select>
                        <select id="ClientArea" name="ClientArea" style="width: 100px;" class="form-control">
                            <option value="0" selected="selected">请选择</option>
                        </select>
                        <select id="ClientRegion" name="ClientRegion" style="width: 100px;" class="form-control">
                            <option value="0">请选择</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <th>
                        详细地址：
                    </th>
                    <td colspan="6">
                        <input class="form-control" id="ClientAddress" name="ClientAddress" placeholder="详细地址"
                            style="width: 100%;" type="text" value="@customer.ClientAddress" />
                    </td>
                </tr>
                <tr>
                    <td class="tit">
                        <label>
                            财务信息</label>
                    </td>
                    <th>
                        总金额：
                    </th>
                    <td>
                        <input class="form-control" id="OrderSumMoney" name="OrderSumMoney" placeholder="订单总金额"
                            style="width: 100px;" type="text" value="0.00" />
                    </td>
                    <th>
                        已付金额：
                    </th>
                    <td>
                        <input class="form-control" id="OrderPrepaid" name="OrderPrepaid" placeholder="预付金额"
                            style="width: 100px;" type="text" value="0.00" />
                    </td>
                    <th>
                        备注：
                    </th>
                    <td colspan="6">
                        <input class="form-control" id="FinNote" name="FinNote" placeholder="财务信息备注" style="width: 100%;"
                            type="text" value="" />
                    </td>
                </tr>
            </tbody>
        </table>
        </form>
        <div style="height: 10px;">
        </div>
        @*<button type="button" class="btn btn-primary btn-lg btn-block teshu" style="position: absolute;
            bottom: 0px;" onclick="submit_order();">
            确认无误，并生成订单信息
        </button>*@
    </div>
</body>
</html>
